package com.yangyouli.unity_demo_server.controller;

import java.util.Date;

import org.apache.log4j.Logger;

import com.yangyouli.unity_demo_server.annotation.ResponseClass;
import com.yangyouli.unity_demo_server.annotation.ResponseMethod;
import com.yangyouli.unity_demo_server.util.ThreadLocalHelper;

@ResponseClass("heartbeatController")
public class HeartbeatController {
	
	Logger log = Logger.getLogger(HeartbeatController.class);
	
	@ResponseMethod("heartbeat")
	public void heartbeat (String data) {
		log.debug(ThreadLocalHelper.getClient().getClientSocket().getInetAddress().getHostAddress() + "的心跳请求到达");
		// 更新接收的心跳时间
		ThreadLocalHelper.getClient().setHeartbeatTime(new Date().getTime());
	}
}
